<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JavaScript全局函数</title>
</head>
<body>
<script type="text/javascript">
	var str="1+2+3";
	//计算字符串的运算结果
	alert(eval(str));
</script>
</body>
</html>